﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Pool;

class SendActiveObjectCreatePacket : MonoBehaviour
{

    public List<float> packetVector;

    public void startWriteFloat()
    {
        packetVector = new List<float>();
    }

    public void writeFloat(float var)
    {
        packetVector.Add(var);
    }

    public ActiveObject createActiveObject(GameObject obj, ActiveObject parent)
    {
        float hpMax = packetVector[0];
        float hp = packetVector[1];
        float mpMax = packetVector[2];
        float mp = packetVector[3];
        float posx = packetVector[4];
        float posy = packetVector[5];
        float dir = packetVector[6]; 

        GameObject newObj = Instantiate(obj, new Vector3(posx, posy,0), Quaternion.identity);
        ActiveObject activeObj = newObj.GetComponent<ActiveObject>();
        activeObj.setHpMax(hpMax);
        activeObj.setHp(hp);
        activeObj.setMpMax(mpMax);
        activeObj.setMp(mp);
        activeObj.setDirection(Dir.numToDirection(dir));
        activeObj.setSummonMaster(parent);
        return activeObj;

    }

    public ActiveObject createActiveObjectLand(GameObject obj)
    {

        return null;
    }


}

